﻿function navEvent() {
    var mUrl = [
        'childHTML/001/001.html',         //动态监测
        //'childHTML/003/003.html',//区域监测
        'childHTML/002/002.html', //站点排行
        'childHTML/004/dataLine.html',//折线图
        'childHTML/005/allCity.html',//柱状图
        'childHTML/006/bar3d.html',//3dbar
        'childHTML/007/cityCompare.html'//cityCompare
    ];
    var mul = $('.navTool > li');
    $('.frame').attr('src', mUrl[0]);
    $(mul[0]).css({backgroundColor: '#FFFFFF', color: 'black', borderLeft: '4px solid green'});
    $.each(mul, function (index, mElement) {
        $(mElement).click(function () {
            $('.frame').attr('src', mUrl[index]);
            setNavUI(mElement);
        });
    });
}

function setNavUI(e) {
    var flag = 0;
    $('.navBtn').css({backgroundColor: '#333333', color: 'white', borderLeft: '0px solid green'});
    $(e).css({backgroundColor: '#FFFFFF', color: 'black', borderLeft: '4px solid green'});
}

function setIframe() {
    var cW = $(document).outerWidth();
    var cH = $(document).height();
    var w = cW - 120,
        h = cH - 80;
    $('.navContent').css({width: w});
    $('.content').css({height: h});
}

$(document).ready(function () {
    setIframe();
    navEvent();


    $(window).resize(function () {
        setIframe();
    });

});